$(function () {
    let id = localStorage.getItem("roomTypeId");
    findByRoomTypeId(id);
});
function findByRoomTypeId(id) {
    let result = myAjax('/back/roomType/findByRoomTypeId','get',{id:id,token:$.cookie("token")});
    showData(result.roomTypeModel);
}
//打开编辑页面 直接给里面选项进行赋值
function showData(data) {
    $("#roomTypeId").val(data.id);
    $("#roomType").val(data.name);
    $("#href").val(data.href);
}
function roomTypeEdit() {
    let data = {};
    data.id=$("#roomTypeId").val();
    data.name=$("#roomType").val();
    data.href=$("#href").val();
    data.token =$.cookie("token");
    let result = myAjax('/back/roomType/roomTypeEdit','post',data);
    if (result.result === 1) {
        alert("提交成功");
        $("#right").load('../back/roomType/roomTypeManage.html');
    } else {
        alert("提交失败")
    }
}
function cancelroomTypeEdit() {
    $("#right").load("/back/roomType/roomTypeManage.html");
}